﻿@model IEnumerable<WSCeCommerce.Domain.Category>
@using WSCeCommerceWeb.Helpers;


@{
    ViewBag.Title = "Index";
    bool allowEdit = SecurityHelper.AlllowManage();
}

<h2 style="text-align:center">Categories</h2>

<p style="text-align:center">
    @if (allowEdit)
    {
    @Html.ActionLink("Create New", "Create");
    }
</p>
<table>
    <tr>
        <th>
          @Html.DisplayNameFor(model => model.CategoryId)  
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
          @Html.ActionLink(item.CategoryName, "Browse", "Category", new { CatId = item.CategoryId }, null)
        
        </td>
        <td> 
        @if (allowEdit)
        {
              
            @Html.ActionLink("Edit", "Edit", new { id=item.CategoryId }) 
            @Html.ActionLink("Details", "Details", new { id=item.CategoryId }) 
            @Html.ActionLink("Delete", "Delete", new { id=item.CategoryId })
        
        }
            </td>
    </tr>
}

</table>
